import { ElNotification } from "element-plus";
import { $post } from "../utils/requst";
import { $get } from "../utils/requst";

//轮播图
export const $SlideshowList = async (params:object)=>{
    let ret = await $get('/system/slideshow/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//产品列表
export const $ProductList = async (params:object)=>{
    let ret = await $get('/system/productManage/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//产品详情
export const $ProductDetails = async (params:object)=>{
    let ret = await $get('/system/productManage/details',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//服务列表
export const $ServiceList = async (params:object)=>{
    let ret = await $get('/system/serviceManage/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例列表
export const $CaseList = async (params:object)=>{
    let ret = await $get('/system/caseManage/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//案例详情
export const $CaseDetails = async (params:object)=>{
    let ret = await $get('/system/caseManage/details',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//新闻动态列表
export const $NewsList = async (params:object)=>{
    let ret = await $get('/system/newsManage/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//新闻动态列表
export const $NewsDetails = async (params:object)=>{
    let ret = await $get('/system/newsManage/details',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//公司列表-关于我们
export const $CompanyInfo = async (params:object)=>{
    let ret = await $get('/system/company/queryCompanyInfo',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//导航栏列表
export const $NavigationList = async (params:object)=>{
    let ret = await $get('/system/navigation/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//联系我们
export const $AddUser = async (params:object)=>{
    let ret = await $post('/system/user/addUser',params)
    console.log(ret)
    if(ret.code == 0){
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'success'
        })
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//微信二维码查询
export const $WechatQuery = async (params:object)=>{
    let ret = await $get('/system/wechat/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}

//用户评价列表查询
export const $EvaluateList = async (params:object)=>{
    let ret = await $get('/system/evaluate/queryList',params)
    console.log(ret)
    if(ret.code == 0){
        return ret
    }else{
        ElNotification({
            title:'通知',
            message: ret.msg,
            type:'error'
        })
        return ret
    }
}